package com.jzo2o.customer.controller.worker;

import com.jzo2o.common.model.CurrentUserInfo;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IWorkerCertificationService;
import com.jzo2o.mvc.utils.UserContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description CertificationController
 * @Author loe
 * @Date 2024-08-14
 */
@RestController
@Api(tags = "服务端--服务人员认证审核相关接口")
@RequestMapping("/worker/worker-certification-audit")
public class WorkCertificationController {

    @Autowired
    private IWorkerCertificationService workerCertificationService;

    @PostMapping
    @ApiOperation("服务端提交认证")
    public void commit(@RequestBody WorkerCertificationAuditAddReqDTO auditAddReqDTO) {
        CurrentUserInfo currentUserInfo = UserContext.currentUser();
        auditAddReqDTO.setServeProviderId(currentUserInfo.getId());
        workerCertificationService.commit(auditAddReqDTO);
    }

    @GetMapping("/rejectReason")
    @ApiOperation("查询最新的驳回原因")
    public RejectReasonResDTO rejectReason() {
        Long userId = UserContext.currentUserId();
        return workerCertificationService.rejectReason(userId);
    }
}
